import request from "@/utils/request";
import qs from "qs";
// 查询列表
export function listIdentify(query) {
  return request({
    url: "/identify/list",
    method: "get",
    params: query,
  });
}

// 查询详细
export function getIdentify(identifyId) {
  return request({
    url: "/identify/" + identifyId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 新增
export function addIdentify(data) {
  return request({
    url: "/identify/add",
    method: "post",
    data: data,
  });
}

// 审核
export function auditIdentify(data) {
  return request({
    url: "/identify/audit",
    method: "post",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    params: data,
  });
}

// 全选所有进行审核
export function auditAllAllIdentify(params, data) {
  console.log("params, data: ", params, data);
  return request({
    url: "/identify/auditAllSelec",
    method: "post",
    // headers: { "content-type": "application/x-www-form-urlencoded" },
    params,
    data,
  });
}

// 修改
export function updateIdentify(data) {
  return request({
    url: "/identify/edit",
    method: "post",
    data: data,
  });
}
// 删除
export function delIdentify(identifyId) {
  return request({
    url: "/identify/remove/" + identifyId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
  });
}

export function downLoadIdentify(data) {
  return request({
    url: "/identify/downLoad",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    responseType: "blob",
    params: data,
  });
}

// 获取标识信息分类树列表
export function identifyClassify(query) {
  return request({
    url: "/identify/treeselect/classify",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "GET",
    params: query,
  });
}
// 获取标识信息公司树列表
export function identifyDept(query) {
  return request({
    url: "/identify/treeselect/dept",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "GET",
    params: query,
  });
}

// 根据标识ID获取详细信息
export function identifyDetail(identifyId) {
  return request({
    url: `/identify/${identifyId}`,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "GET",
  });
}
// 撤销审核标识信息
export function resetAudit(data) {
  return request({
    url: `/identify/resetAudit`,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    params: data,
  });
}
// 通过标识id获取标识审核历史记录
export function getIdentifyAuditList(query) {
  return request({
    url: `/identify/getIdentifyAuditList`,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
    params: query,
  });
}

// 通过标识id下载审批单
export function downLoadApproval(data) {
  return request({
    url: "/identify/downLoadApproval",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    responseType: "blob",
    params: data,
  });
}
// 通过标识id导出
export function exportByIds(query) {
  return request({
    url: "/identify/exportByIds",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    responseType: "blob",
    params: query,
  });
}

// 导出
export function exportIdentify(data) {
  console.log("data: ", data);
  return request({
    url: "/identify/export",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    responseType: "blob",
    data: qs.stringify(data),
  });
}

// 获取用户待处理标识数量（已退回的）  甲方新增功能当管理员用户退回标识记录后，若上传标识的普通投稿员2个月对该标识无操作（删除或修改后提交），增加右上角全局弹框提醒：点击“去处理”按钮，进入	“标识管理 - 标识信息管理”，自动筛选被退回记录。

export function getBackIdentify() {
  return request({
    url: "/getBackIdentify",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}
